package com.woniuxy.enums.user;

import lombok.Getter;

/**
 * 社交关系状态枚举
 *
 * @author 饶志
 * @version 1.0
 * @since 2025-07-12  13:11
 */
@Getter
public enum SocialRelationshipStatus {

    NORMAL(1, "正常"),
    UNFOLLOW(2, "已解除"),
    BLOCKED(3, "已拉黑");

    private final Integer status;
    private final String description;

    SocialRelationshipStatus(Integer status, String description) {
        this.status = status;
        this.description = description;
    }

    /**
     * 根据状态值获取对应的枚举
     *
     * @param status 状态码
     * @return 对应的枚举对象
     */
    public static SocialRelationshipStatus fromStatus(Integer status) {
        for (SocialRelationshipStatus s : values()) {
            if (s.getStatus().equals(status)) {
                return s;
            }
        }
        throw new IllegalArgumentException("Invalid status: " + status);
    }
}
